use pid using ${bhps}\aindresp.dta, clear
g wave=1
save ${temp}\minwave, replace

use pid using ${bhps}\bindresp.dta, clear
g wave=2
append using ${temp}\minwave
save ${temp}\minwave, replace

use pid using ${bhps}\cindresp.dta, clear
g wave=3
append using ${temp}\minwave
save ${temp}\minwave, replace

use pid using ${bhps}\dindresp.dta, clear
g wave=4
append using ${temp}\minwave
save ${temp}\minwave, replace

use pid using ${bhps}\eindresp.dta, clear
g wave=5
append using ${temp}\minwave
save ${temp}\minwave, replace

use pid using ${bhps}\findresp.dta, clear
g wave=6
append using ${temp}\minwave
save ${temp}\minwave, replace

use pid using ${bhps}\gindresp.dta, clear
g wave=7
append using ${temp}\minwave
save ${temp}\minwave, replace

use pid using ${bhps}\hindresp.dta, clear
g wave=8
append using ${temp}\minwave
save ${temp}\minwave, replace

use pid using ${bhps}\iindresp.dta, clear
g wave=9
append using ${temp}\minwave
save ${temp}\minwave, replace

use pid using ${bhps}\jindresp.dta, clear
g wave=10
append using ${temp}\minwave
save ${temp}\minwave, replace

use pid using ${bhps}\kindresp.dta, clear
g wave=11
append using ${temp}\minwave
save ${temp}\minwave, replace

use pid using ${bhps}\lindresp.dta, clear
g wave=12
append using ${temp}\minwave
save ${temp}\minwave, replace

use pid using ${bhps}\mindresp.dta, clear
g wave=13
append using ${temp}\minwave

use pid using ${bhps}\nindresp.dta, clear
g wave=14
append using ${temp}\minwave

use pid using ${bhps}\oindresp.dta, clear
g wave=15
append using ${temp}\minwave

use pid using ${bhps}\pindresp.dta, clear
g wave=16
append using ${temp}\minwave

use pid using ${bhps}\qindresp.dta, clear
g wave=17
append using ${temp}\minwave

use pid using ${bhps}\rindresp.dta, clear
g wave=18
append using ${temp}\minwave

collapse (min) wave, by(pid)
rename wave minwave
sort pid
save ${temp}\minwave, replace


